<!DOCTYPE html>
<html>
  <head>
  <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
     <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>后台登录</title>
    <link type="text/css" rel="stylesheet" href="__PUBLIC__/css/bootstrap.min.css"/>
    <link type="text/css" rel="stylesheet" href="__PUBLIC__/css/bootstrap-material-design.min.css"/>
    <link type="text/css" rel="stylesheet" href="__PUBLIC__/css/ripples.min.css"/>

    <link type="text/css" rel="stylesheet" href="__PUBLIC__/css/base.css"/>
    <link type="text/css" rel="stylesheet" href="__ADMIN_CSS__/ud-style.css"/>
    <link type="text/css" rel="stylesheet" href="__ADMIN_CSS__/login.css"/>
    <block name="style"></block>
    <script type="text/javascript" src="__PUBLIC__/js/jquery-1.10.2.min.js"></script>

  </head>
  <style type="text/css">
       #h1{
        margin: 0px;
       }
       .ud-sign-in-d img{
        margin-top: 6.5%;
       }
  </style>

  <body style="min-width: 420px;">
       <div class="ud-sign-main" >
        
          <div class="ud-sign-top">  
            <h1 id="h1"><img src="__PUBLIC__/images/logo.jpg"</h1>
              </div> 

              <div class="ud-sign-content">
              <h5>登录</h5>
             <div class="ud-sign-container">
              <form method="post">
              <div class="form-group label-floating">
                <label class="control-label ud-input-width" for="user_login">帐号</label>
                <input type="text" class="input radius-none ud-input-width form-control" id="user_login" name="user_login" size="30" />
              </div>
              <div class="form-group label-floating">
                <label class="control-label ud-input-width" for="password">密码</label>
              <input type="password" class="input radius-none ud-input-width form-control" id="password" name="password" size="30"/>
              </div>
              <div class="ud-sign-title">
              <div class="form-group label-floating">
                <label class="control-label " for="ud-code">验证码</label>
                 <input type="text"  style="width: 50%"  id="ud-code" class="input input-auto radius-none fl form-control"  name="code" size="10"/>
         <img class="right" src="{:U('Home/Verify/index')}" id="code" height="34" onclick="verifys('code')"/>
         </div>
                 <div style="clear: both;"></div>

              </div>  
              </form>
             

             </div>

               	<div class="ud-sign-in-e tc">
    	           <button class="radius ud-button bg-color-blue ud-shadow" id="login" type="submit">登录</button>
   		        </div>
           		</div>
           		
   </div>

  	<div class="ud-sign-title">
 		   <p style="text-align:center;">未来永远从现在开始</p>
 		</div>

	</body>
<script type="text/javascript" src="__PUBLIC__/js/bootstrap.min.js"></script>
<script type="text/javascript" src="__PUBLIC__/js/material.min.js"></script>
<script type="text/javascript" src="__PUBLIC__/js/ripples.min.js"></script>
<script type="text/javascript" src="__PUBLIC__/lib/layer/layer.js"></script>
<script type="text/javascript">
  $.material.init();
  function verifys(id){
  			document.getElementById(id).src="{:U('Home/Verify/index')}&"+Math.random(); 
  }

  function BindEnter(obj)
  {
      if(obj.keyCode == 13)

          {
              $("#login").click()
          }
  }

$("#login").click(function(){

  var user_login=$("input[name='user_login']");
  var password=$("input[name='password']");
  var code=$("input[name='code']");

  if(user_login.val()==''){
      user_login.focus();
      return false
  }
  if(code.val()==''){
      code.focus();
      return false
  }
  if(password.val()==''){
    password.focus();
    return false
  }

  $.ajax({
    type: 'POST',
    url: '{:U("/Admin/Public/login")}',
    data: {
      user_login:user_login.val(),
      password:password.val(),
      code:code.val(),
    },

    beforeSend:function(){
      layer.load(2,{shade: [0.1,'#fff']});
    },

    success:function(data){

      layer.closeAll();

      if(data.status==1){

       window.location.href = data.url; 

      }else{
        layer.msg(data.info);
        verifys('code');
      }

    }
});

})
$(document).ready(function(){
        var a = document.body.scrollHeight;
    var b = a*0.55
    $(".ud-sign-main").css("height",b)

});

</script>
</html>
